package com.yunshu.yunshuapp.xianhuo;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import com.yunshu.yunshuapp.NavigationBar;
import com.yunshu.yunshuapp.R;

public class PostCenterActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_post_center);

        NavigationBar bar = (NavigationBar) findViewById(R.id.navigationBar);
        bar.setTitle("发布中心");
        bar.putInActivity(this);

        View templateEntrance = findViewById(R.id.templateEntrance);
        templateEntrance.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                enterTemplates();
            }
        });
        View postsEntrance = findViewById(R.id.postsEntrance);
        postsEntrance.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                enterPosts();
            }
        });

        View postButton = findViewById(R.id.postButton);
        postButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                enterNewPost();
            }
        });
    }

    private void enterNewPost() {
        Intent intent = new Intent();
        intent.setClass(this,PostXianhuoActivity.class);
        startActivity(intent);
    }

    private void enterPosts() {
        Intent intent = new Intent();
        intent.setClass(this,MyPostsActivity.class);
        startActivity(intent);
    }

    private void enterTemplates() {
        Intent intent = new Intent();
        intent.setClass(this,XianhuoTemplateActivity.class);
        startActivity(intent);
    }
}
